
    Vh                         d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZ  ej                  d      ZdZ G d	 d
e      Zd Zd Zedk(  r e        yy)    )absolute_importdivisionprint_functiona  
---
module: smbshare
version_added: '1.1.0'
short_description: Manage SMB shares on Unity storage system
extends_documentation_fragment:
- dellemc.unity.unity
author:
- P Srinivas Rao (@srinivas-rao5) <ansible.team@dell.com>
description:
- Managing SMB Shares on Unity storage system includes create, get,
  modify, and delete the smb shares.
options:
  share_name:
    description:
    - Name of the SMB share.
    - Required during creation of the SMB share.
    - For all other operations either I(share_name) or I(share_id) is required.
    type: str
  share_id:
    description:
    - ID of the SMB share.
    - Should not be specified during creation. Id is auto generated.
    - For all other operations either I(share_name) or I(share_id) is required.
    - If I(share_id) is used then no need to pass nas_server/filesystem/snapshot/path.
    type: str
  path:
    description:
    - Local path to the file system/Snapshot or any existing sub-folder of
      the file system/Snapshot that is shared over the network.
    - Path is relative to the root of the filesystem.
    - Required for creation of the SMB share.
    type: str
  filesystem_id:
    description:
    - The ID of the File System.
    - Either I(filesystem_name) or I(filesystem_id) is required for creation of the SMB share for filesystem.
    - If I(filesystem_name) is specified, then I(nas_server_name)/I(nas_server_id) is required to
      uniquely identify the filesystem.
    - Options I(filesystem_name) and I(filesystem_id) are mutually exclusive parameters.
    type: str
  snapshot_id:
    description:
    - The ID of the Filesystem Snapshot.
    - Either I(snapshot_name) or I(snapshot_id) is required for creation of the SMB share for a snapshot.
    - If I(snapshot_name) is specified, then I(nas_server_name)/I(nas_server_id) is required to
      uniquely identify the snapshot.
    - Options I(snapshot_name) and I(snapshot_id) are mutually exclusive parameters.
    type: str
  nas_server_id:
    description:
    - The ID of the NAS Server.
    - It is not required if I(share_id) is used.
    type: str
  filesystem_name:
    description:
    - The Name of the File System.
    - Either I(filesystem_name) or I(filesystem_id) is required for creation of the SMB share for filesystem.
    - If I(filesystem_name) is specified, then I(nas_server_name)/I(nas_server_id) is required to
      uniquely identify the filesystem.
    - Options I(filesystem_name) and I(filesytem_id) are mutually exclusive parameters.
    type: str
  snapshot_name:
    description:
    - The Name of the Filesystem Snapshot.
    - Either I(snapshot_name) or I(snapshot_id) is required for creation of the SMB share for a snapshot.
    - If I(snapshot_name) is specified, then I(nas_server_name)/I(nas_server_id) is required to
      uniquely identify the snapshot.
    - Options I(snapshot_name) and I(snapshot_id) are mutually exclusive parameters.
    type: str
  nas_server_name:
    description:
    - The Name of the NAS Server.
    - It is not required if I(share_id) is used.
    - Options I(nas_server_name) and I(nas_server_id) are mutually exclusive parameters.
    type: str
  description:
    description:
    - Description for the SMB share.
    - Optional parameter when creating a share.
    - To modify, pass the new value in description field.
    type: str
  is_abe_enabled:
    description:
    - Indicates whether Access-based Enumeration (ABE) for SMB share is enabled.
    - During creation, if not mentioned then default is C(false).
    type: bool
  is_branch_cache_enabled:
    description:
    - Indicates whether Branch Cache optimization for SMB share is enabled.
    - During creation, if not mentioned then default is C(false).
    type: bool
  is_continuous_availability_enabled:
    description:
    - Indicates whether continuous availability for SMB 3.0 is enabled.
    - During creation, if not mentioned then default is C(false).
    type: bool
  is_encryption_enabled:
    description:
    - Indicates whether encryption for SMB 3.0 is enabled at the shared folder level.
    - During creation, if not mentioned then default is C(false).
    type: bool
  offline_availability:
    description:
    - Defines valid states of Offline Availability.
    - C(MANUAL)- Only specified files will be available offline.
    - C(DOCUMENTS)- All files that users open will be available offline.
    - C(PROGRAMS)- Program will preferably run from the offline cache even when
      connected to the network. All files that users open will be available offline.
    - C(NONE)- Prevents clients from storing documents and programs in offline cache.
    type: str
    choices: ["MANUAL","DOCUMENTS","PROGRAMS","NONE"]
  umask:
    description:
    - The default UNIX umask for new files created on the SMB Share.
    type: str
  state:
    description:
    - Define whether the SMB share should exist or not.
    - Value C(present) indicates that the share should exist on the system.
    - Value C(absent) indicates that the share should not exist on the system.
    type: str
    required: true
    choices: ['absent', 'present']
notes:
- When ID/Name of the filesystem/snapshot is passed then I(nas_server) is not required.
  If passed, then filesystem/snapshot should exist for the mentioned I(nas_server),
  else the task will fail.
- The I(check_mode) is not supported.
a
  
- name: Create SMB share for a filesystem
  dellemc.unity.smbshare:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    share_name: "sample_smb_share"
    filesystem_name: "sample_fs"
    nas_server_id: "NAS_11"
    path: "/sample_fs"
    description: "Sample SMB share created"
    is_abe_enabled: true
    is_branch_cache_enabled: true
    offline_availability: "DOCUMENTS"
    is_continuous_availability_enabled: true
    is_encryption_enabled: true
    umask: "777"
    state: "present"
- name: Modify Attributes of SMB share for a filesystem
  dellemc.unity.smbshare:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    share_name: "sample_smb_share"
    nas_server_name: "sample_nas_server"
    description: "Sample SMB share attributes updated"
    is_abe_enabled: false
    is_branch_cache_enabled: false
    offline_availability: "MANUAL"
    is_continuous_availability_enabled: "false"
    is_encryption_enabled: "false"
    umask: "022"
    state: "present"
- name: Create SMB share for a snapshot
  dellemc.unity.smbshare:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    share_name: "sample_snap_smb_share"
    snapshot_name: "sample_snapshot"
    nas_server_id: "NAS_11"
    path: "/sample_snapshot"
    description: "Sample SMB share created for snapshot"
    is_abe_enabled: true
    is_branch_cache_enabled: true
    is_continuous_availability_enabled: true
    is_encryption_enabled: true
    umask: "777"
    state: "present"
- name: Modify Attributes of SMB share for a snapshot
  dellemc.unity.smbshare:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    share_name: "sample_snap_smb_share"
    snapshot_name: "sample_snapshot"
    description: "Sample SMB share attributes updated for snapshot"
    is_abe_enabled: false
    is_branch_cache_enabled: false
    offline_availability: "MANUAL"
    is_continuous_availability_enabled: "false"
    is_encryption_enabled: "false"
    umask: "022"
    state: "present"
- name: Get details of SMB share
  dellemc.unity.smbshare:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    share_id: "{{smb_share_id}}"
    state: "present"
- name: Delete SMB share
  dellemc.unity.smbshare:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    share_id: "{{smb_share_id}}"
    state: "absent"
a  
changed:
    description: Whether or not the resource has changed.
    returned: always
    type: bool
    sample: true
smb_share_details:
    description: The SMB share details.
    type: dict
    returned: When share exists.
    contains:
        id:
            description: The ID of the SMB share.
            type: str
        name:
            description: Name of the SMB share.
            type: str
            sample: "sample_smb_share"
        filesystem_id:
            description: The ID of the Filesystem.
            type: str
        filesystem_name:
            description: The Name of the filesystem
            type: str
        snapshot_id:
            description: The ID of the Snapshot.
            type: str
        snapshot_name:
            description: The Name of the Snapshot.
            type: str
        nas_server_id:
            description: The ID of the nas_server.
            type: str
        nas_server_name:
            description: The Name of the nas_server.
            type: str
        description:
            description: Additional information about the share.
            type: str
            sample: This share is created for demo purpose only.
        is_abe_enabled:
            description: Whether Access Based enumeration is enforced or not.
            type: bool
            sample: false
        is_branch_cache_enabled:
            description: Whether branch cache is enabled or not.
            type: bool
            sample: false
        is_continuous_availability_enabled:
            description: Whether the share will be available continuously or not.
            type: bool
            sample: false
        is_encryption_enabled:
            description: Whether encryption is enabled or not.
            type: bool
            sample: false
        umask:
            description: Unix mask for the SMB share.
            type: str
    sample: {
        "creation_time": "2022-03-17 11:56:54.867000+00:00",
        "description": "",
        "existed": true,
        "export_paths": [
            "\\\\multi-prot-pie.extreme1.com\\multi-prot-hui",
            "\\\\10.230.24.26\\multi-prot-hui"
        ],
        "filesystem": {
            "UnityFileSystem": {
                "hash": 8748426746492
            }
        },
        "filesystem_id": "fs_140",
        "filesystem_name": "multi-prot-hui",
        "hash": 8748426746588,
        "id": "SMBShare_20",
        "is_abe_enabled": false,
        "is_ace_enabled": false,
        "is_branch_cache_enabled": false,
        "is_continuous_availability_enabled": false,
        "is_dfs_enabled": false,
        "is_encryption_enabled": false,
        "is_read_only": null,
        "modified_time": "2022-03-17 11:56:54.867000+00:00",
        "name": "multi-prot-hui",
        "nas_server_id": "nas_5",
        "nas_server_name": "multi-prot",
        "offline_availability": "CifsShareOfflineAvailabilityEnum.NONE",
        "path": "/",
        "snap": null,
        "type": "CIFSTypeEnum.CIFS_SHARE",
        "umask": "022"
    }
)AnsibleModule)utilssmbsharezAnsible/1.7.1c                       e Zd ZdZd Zd Z	 	 ddZ	 	 	 	 	 	 ddZ	 	 ddZd Z	d	 Z
d
 Zd Z	 	 	 	 	 	 ddZd Zd Zy)SMBSharezClass with SMB Share operationsc                 @   t        j                         | _        | j                  j                  t	                      ddgddgg dddgddgddgddgddgdd	gdd
gg
}ddgg}t        | j                  d||      | _        t        j                  | j                         di d| _        t        j                  | j                  j                  t              | _        t         j                  j                  | j                        | _        t         j#                  d       y)z. Define all parameters required by this module
share_nameshare_idnas_server_namenas_server_id)filesystem_namesnapshot_namefilesystem_idsnapshot_idr   r   pathr   r   F)argument_specsupports_check_modemutually_exclusiverequired_one_of)changedsmb_share_detailsz+Connection established with the Unity ArrayN)r   $get_unity_management_host_parametersmodule_paramsupdateget_smb_share_parametersr   moduleensure_required_libsresultget_unity_unisphere_connectionparamsapplication_type
unity_conn
cifs_shareUnityCifsSharesmb_share_conn_objLOGinfo)selfmut_ex_argsr   s      j/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/dellemc/unity/plugins/modules/smbshare.py__init__zSMBShare.__init__N  s&   "GGI!!":"<= %j1)?;8"$56"O4"$56"O4"F+"O4"M2
4 '56#,, %*+	
 	""4;;/ #(,.0  >>KK 02"'"2"2"A"AOO#>?    c                     |t         j                  j                  v rt         j                  |   S dj                  |      }t        j                  |       | j                  j                  |       y)z
        Get the enum of the Offline Availability parameter.
        :param offline_availability: The offline_availability string
        :return: offline_availability enum
        z3Invalid value {0} for offline availability providedmsgN)r    CifsShareOfflineAvailabilityEnum__members__formatr)   errorr   	fail_json)r+   offline_availability	error_msgs      r-   get_offline_availability_enumz&SMBShare.get_offline_availability_enumt  sh      66BBC99$& &$$*F+?$@ IIi KK!!i!0r/   Nc                 b   d}|r|n|}	 |rD| j                   j                  |      }|r%|j                  rt        j	                  d|       |S ||r| j                   j                  ||      S ||r| j                   j                  ||      S ||r| j                   j                  |      }	t        |	t        j                  j                        r>t        j	                  d       |	}
|
D ]  }|j                  j                  |k(  s|c S  d	}y|	j                  j                  |k(  r|	S d	}y| j                  j                  d
       yyy# t        j                  $ r}|j                  dk(  r8dj                  |j                         }| j                  j                  |       nQ|j                  |t#        |            }t        j%                  |       | j                  j                  |       Y d}~yY d}~yd}~wt        j&                  $ r:}|j                  |t#        |            }t        j%                  |       Y d}~yd}~wt(        $ rV}|j                  |t#        |            }t        j%                  |       | j                  j                  |       Y d}~yd}~ww xY w)zGet SMB share detailsz6Failed to get details of SMB Share {0} with error {1} _idz)Successfully got the SMB share object %s N)name
filesystem)r>   snap)r>   z(Multiple SMB share with same name found.zgNo SMB share found with the given NAS Server. Please provide correct share name and nas server details.zShare Name is Passed. Please enter Filesystem/Snapshot/NAS Server Resource along with share_name to get the details of the SMB sharer1     $Incorrect username or password , {0})r%   get_cifs_shareexistedr)   r*   
isinstancer   r&   UnityCifsShareListr?   
nas_serverr   r7   	HttpErrorhttp_statusr5   messagestrr6   UnityResourceNotFoundError	Exception)r+   r   r   filesystem_objsnap_objnas_objr2   	smb_shareobj_smbsmb_share_objsmb_share_obj_listecred_errerr_msgs                 r-   get_smb_share_objzSMBShare.get_smb_share_obj  s    G",J(	M	///88X8FwHH *+24"N'N 55# 6 @ @ 'H 55#( 6 4 4
 'G $ > ># !? !% m#..AACHHGH)6&%7 -	$//::gE#,,-1C   !++66'A((-  %%? & @g  /7p  	3}}#AHHII%%(%3**YA7		'"%%'%22	 4 // 	jjCF3GIIg 	/jjCF3GIIgKK!!g!..	/sc   AE  E 1 E A9E E E E /E 2E J.$BHJ.0IJ.AJ))J.c                 &   ||dk(  r| j                   j                  d       |s|s| j                   j                  d       	 |r:| j                  j                  | j                  j
                  ||||	||||||
      S | j                  j                  | j                  j
                  ||||	||||||
      S # t        $ rL}d|d	t        |      }t        j                  |       | j                   j                  |       Y d}~yd}~ww xY w)
z_
        Create SMB Share
        :return: SMB Share Object if successful, else error.
        N z9Please enter a valid path. Empty string or None provided.r1   zREither Filesystem or Snapshot Resource's Name/ID is required to Create a SMB share)clir>   fsr   is_encryption_enabledis_con_avail_enabledis_abe_enabledis_branch_cache_enabledumaskdescriptionr8   )r[   r>   r@   r   r]   r^   r_   r`   ra   rb   r8   zFailed to create SMB share  with error )r   r7   r(   creater%   _clicreate_from_snaprM   rK   r)   r6   )r+   r   r   rN   snapshot_objrb   r_   r`   "is_continuous_availability_enabledr]   r8   ra   rU   r9   s                 r-   create_smb_sharezSMBShare.create_smb_share  s(    <42:KK!! 'H! IlKK!! '<! =	1..55,,:%D*?)K#1,C[)= 6 ? ? ..??,,:%D*?)K#1,C[)= @ ? ?  	1/93q6CIIIi KK!!i!00		1s   ;B; 9B; ;	DADDc                    	 |rC| j                   j                  |      }|r$|j                  rt        j	                  d|       |S y| j                   j                  ||      S # t
        $ r\}|r|n|}dj                  |t        |            }t        j                  |       | j                  j                  |       Y d}~yd}~ww xY w)z
        Get the Filesystem Object.
        :param filesystem_id: ID of the Filesystem.
        :param filesystem_name: Name of the filesystem.
        :param nas_server_obj: NAS Server object.
        :return: Object of the filesystem.
        r<   z*Successfully got the filesystem object %s )r>   rG   Nz3Failed to get filesystem details {0} with error {1}r1   )r%   get_filesystemrD   r)   r*   rM   r5   rK   r6   r   r7   )r+   r   r   nas_server_objobj_fsrU   r?   rW   s           r-   rk   zSMBShare.get_filesystem  s    	/77M7JfnnHH *+13!M  55(^ 6 E E  	/,;" ##)6*c!f#= IIgKK!!g!..	/s   AA$ A$ $	C	-ACC	c                 `   	 | j                   j                  ||      }|r%|r#|j                  st        j	                  d|       y|S # t
        $ r\}|r|n|}dj                  |t        |            }t        j                  |       | j                  j                  |       Y d}~yd}~ww xY w)z
        Get the Snapshot Object.
        :param snapshot_id: ID of the Snapshot.
        :param snapshot_name: Name of the Snapshot
        :return: Object of the filesystem.
        r=   r>   z"Snapshot object does not exist %s Nz=Failed to get filesystem snapshots details {0} with error {1}r1   )r%   get_snaprD   r)   r*   rM   r5   rK   r6   r   r7   )r+   r   r   obj_snaprU   snapshotrW   s          r-   get_snapshotzSMBShare.get_snapshot!  s    	///K5B 0 DHx0@0@=xHO 	/(5};H##)6(CF#; IIgKK!!g!..	/s   AA A 	B-AB((B-c                    |r|n|}	 | j                   j                  ||      }|r%|r#|j                  st        j	                  d|       y|S # t
        j                  $ r}|j                  dk(  r8dj                  |j                        }| j                  j                  |       nQdj                  |t        |            }t        j                  |       | j                  j                  |       Y d}~yY d}~yd}~wt        $ r\}|r|n|}dj                  |t        |            }t        j                  |       | j                  j                  |       Y d}~yd}~ww xY w)	z
        Get the NAS Server Object using NAME/ID of the NAS Server.
        :param nas_server_name: Name of the NAS Server
        :param nas_server_id: ID of the NAS Server
        :return: NAS Server object.
        ro   z$NAS Server object does not exist %s NrA   rB   r1   z6Failed to get details of NAS Server {0} with error {1}z3Failed to get nas server details {0} with error {1})r%   get_nas_serverrD   r)   r*   r   rH   rI   r5   rJ   r   r7   rK   r6   rM   )r+   r   r   rG   obj_nasrU   rV   rW   s           r-   ru   zSMBShare.get_nas_server6  s8    )8_]
	/oo44:I 5 KG?IN 		3}}#AHHII%%(%3006z3q60J 		'"%%'%22 4  	/,;" ##)6*c!f#= IIgKK!!g!..	/s,   AA A E&!BC>>E&
AE!!E&c                     	 |j                          y# t        $ rV}d|j                  dt        |      }t        j                  |       | j                  j                  |       Y d}~yd}~ww xY w)z@
        Delete SMB share if exists, else thrown error.
        zFailed to Delete SMB share rc   r1   N)deleterM   r>   rK   r)   r6   r   r7   )r+   rS   rU   r9   s       r-   delete_smb_sharezSMBShare.delete_smb_shareW  s^    	1  " 	1/</A/A3q6KIIIi KK!!i!00		1s    	A2AA--A2c                 V   t         j                  d       | j                  j                  d   }|r| j	                  |      }|||j
                  k7  ry|j                         }g d}|D ]=  }| j                  j                  |   | j                  j                  |   ||   k7  s= y y)Nz4Checking Whether the parameters are modified or not.r8   T)r_   r`   rh   r]   rb   ra   F)r)   r*   r   r#   r:   r8   _get_properties)r+   rS   r8   smb_share_dictparams_listparams         r-   	to_updatezSMBShare.to_updatec  s    GH#{{112HI223GH !+$(J(JJ&668H ! 	E{{!!%(4KK&&u-1FF	 r/   c	           	          	 |j                  |||||||       y# t        $ rV}	d|j                  dt        |	      }
t        j                  |
       | j                  j                  |
       Y d}	~	yd}	~	ww xY w)zO
        The Details of the SMB share will be updated in the function.
        )r]   r^   r_   r`   ra   rb   r8   z)Failed to Update parameters of SMB share rc   r1   N)modifyrM   r>   rK   r)   r6   r   r7   )r+   rS   r]   rh   r_   r`   ra   rb   r8   rU   r9   s              r-   update_smb_sharezSMBShare.update_smb_sharey  s{    	1  &;%G-(?%9 ! ;  	1/</A/A3q6KIIIi KK!!i!00		1s    	A:AA55A:c                 >
   | j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d	   }	| j                   j                  d
   }
| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }| j                   j                  d   }|r| j                  |      }d}	 |=|dk(  st        |j	                               dk(  r| j                   j                  d       	 d}|s|	r| j                  ||	      }|r5dj                  |j                               }t        j                  |       nd}t        j                  |       	 d}|r| j                  |      }|r1|s| j                   j                  d       | j                  d||      }|r4dj                  |j                               }t        j                  |       |r5|j                  j                  dk(  r| j                   j                  d       	 d}|s|r| j                  ||      }|r5dj                  |j                               }t        j                  |       nd}t        j                  |       	 | j                  |||||      }|r5d j                  |j                               }t        j                  |       n:|d!k(  r5|r3d"}t        j!                  |       | j                   j                  |       	 |d!k(  r|s| j#                  ||
|||||||||      }d#}	 |d!k(  rs|rqt        j                  d$       | j%                  |      }d%j                  t'        |            }t        j                  |       |r| j)                  ||||||||       d#}	 |d&k(  r|r| j+                  |       d#}	 || j,                  d'<   | j/                  ||||||      }|| j,                  d(<    | j                   j0                  d)i | j,                   y)*zl
        Perform different actions on SMB share based on user parameters
        chosen in playbook
        stater   r   r   r   r   r   r   r   r   rb   r`   rh   r]   r_   ra   r8   FNrZ   r   z9Invalid share id provided. Please enter a valid share ID.r1   zNAS Server Object: {0}z NAS Server Resource not fetched.zHnas_server_id/nas_server_name is required when filesystem_name is passedzFilesystem Object: {0}NFSzCannot perform SMB share operations as file system supports only NFS protocol. Please enter a valid Filesystem having supported protocol as SMB or Multiprotocol.zSnapshot Object: {0}zSnapshot Resource not fetched.zSMB Share Object: {0}presentzeUnable to fetch SMB Share Resource. Incorrect SMB share id provided. Please enter a correct share id.Tz$Modify the details of the SMB share.zUpdate Flag: {0}absentr   r    )r   r#   r:   lensplitr7   ru   r5   r{   r)   r*   rk   supported_protocolsr>   rs   rX   r6   ri   r   rK   r   ry   r!   prepare_output_dict	exit_json)r+   r   r   r   r   r   r   r   r   r   r   rb   r`   rh   r]   r_   ra   r8   r   rl   r2   rN   rg   rS   update_flagsmb_detailss                             r-   perform_module_operationz!SMBShare.perform_module_operation  s   
 ""7+[[''5
++,,->?**?;++,,->?;;%%j1**?;kk((7**?;{{!!&)kk((7KK89 	  KKCD 	+ $ 2 23J K++,<=""7+#{{112HI223GH ! 	 R3x~~'7#8A#=KK!! 'H! I	 m!001>@N > > @A HHSM4CHHSM	 !00?N "%% +3% 4 "00o~7N > > @A HHSM22775@KK!! 'B! C
	 -  ,,]KHL < < >? HHSM2CHHSM	 ..j.,  = = ?@ HHSMiH5C IIcNKK!!c!*	 Im 11D., 724I$e	-M
 G	 I-HH;<..7K$++C,<=CHHSM%%m5J&H&4&=&+[&:< 	 H!!-0G	 ")I..uh
/=|/=? ,7'(,,r/   c                    d }d }|dk(  r%| j                  |||||      }|j                         }|r|j                  j                  dk(  r2|j                  j                  |d<   |j                  j
                  |d<   |j                  j                  |d<   |j                  j
                  |d<   |j                  j                  j                  |d<   |j                  j                  j
                  |d<   |S )	Nr   CIFS_SNAPSHOTr   r   r   r   r   r   )rX   r{   typer>   r@   idr?   rG   )	r+   r   r   r   rN   rg   rl   r   rS   s	            r-   r   zSMBShare.prepare_output_dict3  s    I 22*nn.M !. = = ?!!&&/95B5G5G5L5L!/23@3E3E3H3H!-0 ((-- /01>1I1I1L1Lo. ((3388 /0 ((3366 o.  r/   )NNNNN)	NNNNNNNNN)NNN)NNNNNNN)__name__
__module____qualname____doc__r.   r:   rX   ri   rk   rs   ru   ry   r   r   r   r   r   r/   r-   r
   r
   K  s    )$@L1  ;?FJR/h AE8<FJ<@/3:>+1Z BF&*/8/*/B
1, EI<@(,1515.210`-D!r/   r
   c            
         t        di dt               dt               dt               dt               dt               dt               dt               dt               d	t        d
      dt               dt               dt        g d      dt        d      dt        d      dt        d      dt        d      dt        d
ddgd      S )za
    This method provides parameters required for the ansible smb share
    modules on Unity
    r   r   r   r   r   r   r   r   r   T)no_logra   rb   r8   )MANUAL	DOCUMENTSPROGRAMSNONE)choicesr_   bool)r   r`   rh   r]   r   r   r   rK   )requiredr   r   r   )dictr   r/   r-   r   r   O  s      6$(F.2f f +/& 	 /3f	
 
 '+f
 ;?& "?A ( !%& 1 ,0V+< #/ D9h*?eL r/   c                  8    t               } | j                          y)za Create Unity SMB share object and perform action on it
        based on user input from playbookN)r
   r   )objs    r-   mainr   e  s     *C  "r/   __main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   Cansible_collections.dellemc.unity.plugins.module_utils.storage.dellr   
get_loggerr)   r$   objectr
   r   r   r   r   r/   r-   <module>r      s    C BAFTl]
~ 5 ez"" A!v A!H,# zF r/   